﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GLSimulationControl;

namespace _3CMillingSimulator
{
    public partial class VisualSettings : Form
    {
        public SimulatorControlGL SimulationControl { get; set; }

        public VisualSettings()
        {
            InitializeComponent();
            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
                GetValues();
        }

        private void GetValues()
        {
            this.fovValueSlider.Value = SimulatorControlGL.GetFOV();
            this.cameraPosXValueSlider.Value = SimulatorControlGL.GetCameraPosX();
            this.cameraPosYValueSlider.Value = SimulatorControlGL.GetCameraPosY();
            this.cameraPosZValueSlider.Value = SimulatorControlGL.GetCameraPosZ();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            //_3CMillingSimulator.Properties.Settings.Default
            this.Close();
        }

        private void fovValueSlider_OnValueChanged(CADUI.ValueChangedArgs valueChanged)
        {
            SimulatorControlGL.SetFOV( valueChanged.Value );
            if (this.SimulationControl != null)
                this.SimulationControl.Refresh();
        }

        private void cameraPosXValueSlider_OnValueChanged(CADUI.ValueChangedArgs valueChanged)
        {
            SimulatorControlGL.SetCameraPosX( valueChanged.Value );
            if (this.SimulationControl != null)
                this.SimulationControl.Refresh();
        }

        private void cameraPosYValueSlider_OnValueChanged(CADUI.ValueChangedArgs valueChanged)
        {
            SimulatorControlGL.SetCameraPosY( valueChanged.Value );
            if (this.SimulationControl != null)
                this.SimulationControl.Refresh();
        }

        private void cameraPosZValueSlider_OnValueChanged(CADUI.ValueChangedArgs valueChanged)
        {
            SimulatorControlGL.SetCameraPosZ( valueChanged.Value );
            if (this.SimulationControl != null)
                this.SimulationControl.Refresh();
        }
    }
}
